﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SocialLearning.CoreInterfaces;
using System.Runtime.Serialization;

namespace SocialLearning
{
    public class Test : I_CMA_ModuleImplementation
    {
        private I_CMA_Core core;

        public void LoadModule(I_CMA_Core core)
        {
            // core = An implementation to access the core's features.
            this.core = core;
        }

        public void UnloadModule()
        {
            // Called when the user disconnects.
        }

        // All public methods in this class will be available via the
        // InvokeMethod service method (except the above two).

        public void Echo(string text)
        {
            // Returns the text sent to the module.
            core.BroadcastPing(123, text);
        }

        public string Dummy() { return "Uber Dummy"; }

        public string XYZ() { return ("hi"); }

        public List<string> XXX() {
            List<string> y = new List<string>(); y.Add("yYY"); y.Add("ZZZ"); return (y); }

        public List<AMP_Feed> GetFeeds()
        {
            AMP_Feed x;
            List<AMP_Feed> l = new List<AMP_Feed>();

            x = new AMP_Feed();
            x.FeedID = 1; x.FeedIcon = "X"; x.FeedTit = "1"; x.Content = "Hi!"; x.DateTime = "1"; l.Add(x);
            x = new AMP_Feed();
            x.FeedID = 2; x.FeedIcon = "Y"; x.FeedTit = "2"; x.Content = "Hi324!"; x.DateTime = "1"; l.Add(x);
            x = new AMP_Feed();
            x.FeedID = 3; x.FeedIcon = "Z"; x.FeedTit = "3"; x.Content = "dfgfdgfdg"; x.DateTime = "1"; l.Add(x);
            x = new AMP_Feed();
            x.FeedID = 4; x.FeedIcon = "W"; x.FeedTit = "4"; x.Content = "ASfedwed"; x.DateTime = "1"; l.Add(x);
            x = new AMP_Feed();
            x.FeedID = 5; x.FeedIcon = "Q"; x.FeedTit = "5"; x.Content = "Hisfsdfsdfewgewf"; x.DateTime = "1"; l.Add(x);
            x = new AMP_Feed();
            x.FeedID = 6; x.FeedIcon = "A"; x.FeedTit = "6"; x.Content = "asdwwdwqd!"; x.DateTime = "1"; l.Add(x);

            return (l);
        }

        public AMP_Feed[] EchoFeed(string a, AMP_Feeds feeds, string b)
        {
            return (feeds.Feeds.ToArray());
        }

        public X GetX() { return new X(GetFeeds().ToArray()); }

        public AMP_Feed GetFeed()
        {
            return (GetFeeds()[0]);
        }
    }

    [DataContract]
    public class X
    {
        public AMP_Feed[] F;

        public X(AMP_Feed[] x) { F = x; }

        [DataMember]
        public AMP_Feed[] Y { get { return (F); } set { F = value; } }

        [DataMember]
        public List<AMP_Feed> W { get { return (new List<AMP_Feed>(F)); } set { F = value.ToArray(); } }

        [DataMember]
        public DateTime Z { get { return (DateTime.Now); } set { } }
    }


    [DataContract]
    public class AMP_Feeds
    {
        [DataMember]
        public List<AMP_Feed> Feeds;
    }

    [DataContract]
    public class AMP_Feed
    {
        private int feedID;
        private string feedIcon;
        private string feedTit;
        private string dateTime;
        private string content;
               
        [DataMember]
        public virtual int FeedID
        {
            get { return feedID; }
            set { feedID = value; }
        }
        [DataMember]
        public virtual string FeedIcon
        {
            get { return feedIcon; }
            set { feedIcon = value; }
        }
        [DataMember]
        public virtual string FeedTit
        {
            get { return feedTit; }
            set { feedTit = value; }
        }
        [DataMember]
        public virtual string DateTime
        {
            get { return dateTime.ToString(); }
            set { dateTime = value; }
        }
        [DataMember]
        public virtual string Content
        {
            get { return content; }
            set { content = value; }
        }
    }
}
